home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / dom / nsIDOMClassInfo.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  21KB  |  535 lines

  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4.  *
  5.  * The contents of this file are subject to the Mozilla Public License Version
  6.  * 1.1 (the "License"); you may not use this file except in compliance with
  7.  * the License. You may obtain a copy of the License at
  8.  * http://www.mozilla.org/MPL/
  9.  *
  10.  * Software distributed under the License is distributed on an "AS IS" basis,
  11.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12.  * for the specific language governing rights and limitations under the
  13.  * License.
  14.  *
  15.  * The Original Code is mozilla.org code.
  16.  *
  17.  * The Initial Developer of the Original Code is
  18.  * Netscape Communications Corporation.
  19.  * Portions created by the Initial Developer are Copyright (C) 2000
  20.  * the Initial Developer. All Rights Reserved.
  21.  *
  22.  * Contributor(s):
  23.  *   Johnny Stenback <jst@netscape.com> (original author)
  24.  *
  25.  * Alternatively, the contents of this file may be used under the terms of
  26.  * either of the GNU General Public License Version 2 or later (the "GPL"),
  27.  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  28.  * in which case the provisions of the GPL or the LGPL are applicable instead
  29.  * of those above. If you wish to allow use of your version of this file only
  30.  * under the terms of either the GPL or the LGPL, and not to allow others to
  31.  * use your version of this file under the terms of the MPL, indicate your
  32.  * decision by deleting the provisions above and replace them with the notice
  33.  * and other provisions required by the GPL or the LGPL. If you do not delete
  34.  * the provisions above, a recipient may use your version of this file under
  35.  * the terms of any one of the MPL, the GPL or the LGPL.
  36.  *
  37.  * ***** END LICENSE BLOCK ***** */
  38.  
  39. #ifndef nsIDOMClassInfo_h___
  40. #define nsIDOMClassInfo_h___
  41.  
  42. #include "nsIClassInfo.h"
  43. #include "nsVoidArray.h"
  44.  
  45. enum nsDOMClassInfoID {
  46.   // Base classes
  47.   eDOMClassInfo_Window_id,
  48.   eDOMClassInfo_Location_id,
  49.   eDOMClassInfo_Navigator_id,
  50.   eDOMClassInfo_Plugin_id,
  51.   eDOMClassInfo_PluginArray_id,
  52.   eDOMClassInfo_MimeType_id,
  53.   eDOMClassInfo_MimeTypeArray_id,
  54.   eDOMClassInfo_BarProp_id,
  55.   eDOMClassInfo_History_id,
  56.   eDOMClassInfo_Screen_id,
  57.  
  58.   // Core classes
  59.   eDOMClassInfo_XMLDocument_id,
  60.   eDOMClassInfo_DocumentType_id,
  61.   eDOMClassInfo_DOMImplementation_id,
  62.   eDOMClassInfo_DOMException_id,
  63.   eDOMClassInfo_DocumentFragment_id,
  64.   eDOMClassInfo_Element_id,
  65.   eDOMClassInfo_Attr_id,
  66.   eDOMClassInfo_Text_id,
  67.   eDOMClassInfo_Comment_id,
  68.   eDOMClassInfo_CDATASection_id,
  69.   eDOMClassInfo_ProcessingInstruction_id,
  70.   eDOMClassInfo_Entity_id,
  71.   eDOMClassInfo_EntityReference_id,
  72.   eDOMClassInfo_Notation_id,
  73.   eDOMClassInfo_NodeList_id,
  74.   eDOMClassInfo_NamedNodeMap_id,
  75.  
  76.   // StyleSheet classes
  77.   eDOMClassInfo_DocumentStyleSheetList_id,
  78.  
  79.   // Event classes
  80.   eDOMClassInfo_Event_id,
  81.   eDOMClassInfo_MutationEvent_id,
  82.   eDOMClassInfo_UIEvent_id,
  83.   eDOMClassInfo_MouseEvent_id,
  84.   eDOMClassInfo_KeyboardEvent_id,
  85.   eDOMClassInfo_PopupBlockedEvent_id,
  86.  
  87.   // HTML classes
  88.   eDOMClassInfo_HTMLDocument_id,
  89.   eDOMClassInfo_HTMLCollection_id,
  90.   eDOMClassInfo_HTMLOptionsCollection_id,
  91.   eDOMClassInfo_HTMLFormControlCollection_id,
  92.   eDOMClassInfo_HTMLGenericCollection_id,
  93.  
  94.   // HTML element classes
  95.   eDOMClassInfo_HTMLAnchorElement_id,
  96.   eDOMClassInfo_HTMLAppletElement_id,
  97.   eDOMClassInfo_HTMLAreaElement_id,
  98.   eDOMClassInfo_HTMLBRElement_id,
  99.   eDOMClassInfo_HTMLBaseElement_id,
  100.   eDOMClassInfo_HTMLBaseFontElement_id,
  101.   eDOMClassInfo_HTMLBodyElement_id,
  102.   eDOMClassInfo_HTMLButtonElement_id,
  103.   eDOMClassInfo_HTMLDListElement_id,
  104.   eDOMClassInfo_HTMLDelElement_id,
  105.   eDOMClassInfo_HTMLDirectoryElement_id,
  106.   eDOMClassInfo_HTMLDivElement_id,
  107.   eDOMClassInfo_HTMLEmbedElement_id,
  108.   eDOMClassInfo_HTMLFieldSetElement_id,
  109.   eDOMClassInfo_HTMLFontElement_id,
  110.   eDOMClassInfo_HTMLFormElement_id,
  111.   eDOMClassInfo_HTMLFrameElement_id,
  112.   eDOMClassInfo_HTMLFrameSetElement_id,
  113.   eDOMClassInfo_HTMLHRElement_id,
  114.   eDOMClassInfo_HTMLHeadElement_id,
  115.   eDOMClassInfo_HTMLHeadingElement_id,
  116.   eDOMClassInfo_HTMLHtmlElement_id,
  117.   eDOMClassInfo_HTMLIFrameElement_id,
  118.   eDOMClassInfo_HTMLImageElement_id,
  119.   eDOMClassInfo_HTMLInputElement_id,
  120.   eDOMClassInfo_HTMLInsElement_id,
  121.   eDOMClassInfo_HTMLIsIndexElement_id,
  122.   eDOMClassInfo_HTMLLIElement_id,
  123.   eDOMClassInfo_HTMLLabelElement_id,
  124.   eDOMClassInfo_HTMLLegendElement_id,
  125.   eDOMClassInfo_HTMLLinkElement_id,
  126.   eDOMClassInfo_HTMLMapElement_id,
  127.   eDOMClassInfo_HTMLMenuElement_id,
  128.   eDOMClassInfo_HTMLMetaElement_id,
  129.   eDOMClassInfo_HTMLModElement_id,
  130.   eDOMClassInfo_HTMLOListElement_id,
  131.   eDOMClassInfo_HTMLObjectElement_id,
  132.   eDOMClassInfo_HTMLOptGroupElement_id,
  133.   eDOMClassInfo_HTMLOptionElement_id,
  134.   eDOMClassInfo_HTMLParagraphElement_id,
  135.   eDOMClassInfo_HTMLParamElement_id,
  136.   eDOMClassInfo_HTMLPreElement_id,
  137.   eDOMClassInfo_HTMLQuoteElement_id,
  138.   eDOMClassInfo_HTMLScriptElement_id,
  139.   eDOMClassInfo_HTMLSelectElement_id,
  140.   eDOMClassInfo_HTMLSpacerElement_id,
  141.   eDOMClassInfo_HTMLSpanElement_id,
  142.   eDOMClassInfo_HTMLStyleElement_id,
  143.   eDOMClassInfo_HTMLTableCaptionElement_id,
  144.   eDOMClassInfo_HTMLTableCellElement_id,
  145.   eDOMClassInfo_HTMLTableColElement_id,
  146.   eDOMClassInfo_HTMLTableColGroupElement_id,
  147.   eDOMClassInfo_HTMLTableElement_id,
  148.   eDOMClassInfo_HTMLTableRowElement_id,
  149.   eDOMClassInfo_HTMLTableSectionElement_id,
  150.   eDOMClassInfo_HTMLTextAreaElement_id,
  151.   eDOMClassInfo_HTMLTitleElement_id,
  152.   eDOMClassInfo_HTMLUListElement_id,
  153.   eDOMClassInfo_HTMLUnknownElement_id,
  154.   eDOMClassInfo_HTMLWBRElement_id,
  155.  
  156.   // CSS classes
  157.   eDOMClassInfo_CSSStyleRule_id,
  158.   eDOMClassInfo_CSSCharsetRule_id,
  159.   eDOMClassInfo_CSSImportRule_id,
  160.   eDOMClassInfo_CSSMediaRule_id,
  161.   eDOMClassInfo_CSSNameSpaceRule_id,
  162.   eDOMClassInfo_CSSRuleList_id,
  163.   eDOMClassInfo_CSSGroupRuleRuleList_id,
  164.   eDOMClassInfo_MediaList_id,
  165.   eDOMClassInfo_StyleSheetList_id,
  166.   eDOMClassInfo_CSSStyleSheet_id,
  167.   eDOMClassInfo_CSSStyleDeclaration_id,
  168.   eDOMClassInfo_ComputedCSSStyleDeclaration_id,
  169.   eDOMClassInfo_ROCSSPrimitiveValue_id,
  170.  
  171.   // Range classes
  172.   eDOMClassInfo_Range_id,
  173.   eDOMClassInfo_Selection_id,
  174.  
  175.   // XUL classes
  176. #ifdef MOZ_XUL
  177.   eDOMClassInfo_XULDocument_id,
  178.   eDOMClassInfo_XULElement_id,
  179.   eDOMClassInfo_XULCommandDispatcher_id,
  180.   eDOMClassInfo_XULNodeList_id,
  181.   eDOMClassInfo_XULNamedNodeMap_id,
  182.   eDOMClassInfo_XULAttr_id,
  183. #endif
  184.   eDOMClassInfo_XULControllers_id,
  185. #ifdef MOZ_XUL
  186.   eDOMClassInfo_BoxObject_id,
  187.   eDOMClassInfo_TreeSelection_id,
  188.   eDOMClassInfo_TreeContentView_id,
  189. #endif
  190.  
  191.   // Crypto classes
  192.   eDOMClassInfo_Crypto_id,
  193.   eDOMClassInfo_CRMFObject_id,
  194.   eDOMClassInfo_Pkcs11_id,
  195.   
  196.   // DOM Traversal classes
  197.   eDOMClassInfo_TreeWalker_id,
  198.  
  199.   // We are now trying to preserve binary compat in classinfo.  No
  200.   // more putting things in those categories up there.  New entries
  201.   // are to be added right before eDOMClassInfoIDCount.
  202.  
  203.   // Rect object used by getComputedStyle
  204.   eDOMClassInfo_CSSRect_id,
  205.  
  206.   // DOM Chrome Window class, almost identical to Window
  207.   eDOMClassInfo_ChromeWindow_id,
  208.  
  209.   // RGBColor object used by getComputedStyle
  210.   eDOMClassInfo_CSSRGBColor_id,
  211.  
  212.   eDOMClassInfo_RangeException_id,
  213.  
  214.   // CSSValueList object that represents an nsIDOMCSSValueList, used
  215.   // by DOM CSS
  216.   eDOMClassInfo_CSSValueList_id,
  217.  
  218.   // ContentList object used for various live NodeLists
  219.   eDOMClassInfo_ContentList_id,
  220.   
  221.   // Processing-instruction with target "xml-stylesheet"
  222.   eDOMClassInfo_XMLStylesheetProcessingInstruction_id,
  223.   
  224.   eDOMClassInfo_ImageDocument_id,
  225.  
  226. #ifdef MOZ_XUL
  227.   eDOMClassInfo_XULTemplateBuilder_id,
  228.   eDOMClassInfo_XULTreeBuilder_id,
  229. #endif
  230.  
  231.   // DOMStringList object
  232.   eDOMClassInfo_DOMStringList_id,
  233.  
  234.   // NameList object used by the DOM
  235.   eDOMClassInfo_NameList_id,
  236.  
  237. #ifdef MOZ_XUL
  238.   eDOMClassInfo_TreeColumn_id,
  239.   eDOMClassInfo_TreeColumns_id,
  240. #endif
  241.  
  242.   eDOMClassInfo_CSSMozDocumentRule_id,
  243.  
  244.   eDOMClassInfo_BeforeUnloadEvent_id,
  245.  
  246. #ifdef MOZ_SVG
  247.   // The SVG document
  248.   eDOMClassInfo_SVGDocument_id,
  249.  
  250.   // SVG element classes
  251.   eDOMClassInfo_SVGCircleElement_id,
  252.   eDOMClassInfo_SVGClipPathElement_id,
  253.   eDOMClassInfo_SVGDefsElement_id,
  254.   eDOMClassInfo_SVGDescElement_id,
  255.   eDOMClassInfo_SVGEllipseElement_id,
  256.   eDOMClassInfo_SVGGElement_id,
  257.   eDOMClassInfo_SVGGradientElement_id,
  258.   eDOMClassInfo_SVGImageElement_id,
  259.   eDOMClassInfo_SVGLinearGradientElement_id,
  260.   eDOMClassInfo_SVGLineElement_id,
  261.   eDOMClassInfo_SVGMarkerElement_id,
  262.   eDOMClassInfo_SVGMetadataElement_id,
  263.   eDOMClassInfo_SVGPathElement_id,
  264.   eDOMClassInfo_SVGPolygonElement_id,
  265.   eDOMClassInfo_SVGPolylineElement_id,
  266.   eDOMClassInfo_SVGRadialGradientElement_id,
  267.   eDOMClassInfo_SVGRectElement_id,
  268.   eDOMClassInfo_SVGScriptElement_id,
  269.   eDOMClassInfo_SVGStopElement_id,
  270.   eDOMClassInfo_SVGStyleElement_id,
  271.   eDOMClassInfo_SVGSVGElement_id,
  272.   eDOMClassInfo_SVGSymbolElement_id,
  273.   eDOMClassInfo_SVGTextElement_id,
  274.   eDOMClassInfo_SVGTitleElement_id,
  275.   eDOMClassInfo_SVGTSpanElement_id,
  276.   eDOMClassInfo_SVGUseElement_id,
  277.  
  278.   // other SVG classes
  279.   eDOMClassInfo_SVGAngle_id,
  280.   eDOMClassInfo_SVGAnimatedAngle_id,
  281.   eDOMClassInfo_SVGAnimatedEnumeration_id,
  282.   eDOMClassInfo_SVGAnimatedLength_id,
  283.   eDOMClassInfo_SVGAnimatedLengthList_id,
  284.   eDOMClassInfo_SVGAnimatedNumber_id,
  285.   eDOMClassInfo_SVGAnimatedNumberList_id,
  286.   eDOMClassInfo_SVGAnimatedPoints_id,
  287.   eDOMClassInfo_SVGAnimatedPreserveAspectRatio_id,
  288.   eDOMClassInfo_SVGAnimatedRect_id,
  289.   eDOMClassInfo_SVGAnimatedString_id,
  290.   eDOMClassInfo_SVGAnimatedTransformList_id,
  291.   eDOMClassInfo_SVGEvent_id,
  292.   eDOMClassInfo_SVGException_id,
  293.   eDOMClassInfo_SVGLength_id,
  294.   eDOMClassInfo_SVGLengthList_id,
  295.   eDOMClassInfo_SVGMatrix_id,
  296.   eDOMClassInfo_SVGNumber_id,
  297.   eDOMClassInfo_SVGNumberList_id,
  298.   eDOMClassInfo_SVGPathSegArcAbs_id,
  299.   eDOMClassInfo_SVGPathSegArcRel_id,
  300.   eDOMClassInfo_SVGPathSegClosePath_id,
  301.   eDOMClassInfo_SVGPathSegCurvetoCubicAbs_id,
  302.   eDOMClassInfo_SVGPathSegCurvetoCubicRel_id,
  303.   eDOMClassInfo_SVGPathSegCurvetoCubicSmoothAbs_id,
  304.   eDOMClassInfo_SVGPathSegCurvetoCubicSmoothRel_id,
  305.   eDOMClassInfo_SVGPathSegCurvetoQuadraticAbs_id,
  306.   eDOMClassInfo_SVGPathSegCurvetoQuadraticRel_id,
  307.   eDOMClassInfo_SVGPathSegCurvetoQuadraticSmoothAbs_id,
  308.   eDOMClassInfo_SVGPathSegCurvetoQuadraticSmoothRel_id,
  309.   eDOMClassInfo_SVGPathSegLinetoAbs_id,
  310.   eDOMClassInfo_SVGPathSegLinetoHorizontalAbs_id,
  311.   eDOMClassInfo_SVGPathSegLinetoHorizontalRel_id,
  312.   eDOMClassInfo_SVGPathSegLinetoRel_id,
  313.   eDOMClassInfo_SVGPathSegLinetoVerticalAbs_id,
  314.   eDOMClassInfo_SVGPathSegLinetoVerticalRel_id,
  315.   eDOMClassInfo_SVGPathSegList_id,
  316.   eDOMClassInfo_SVGPathSegMovetoAbs_id,
  317.   eDOMClassInfo_SVGPathSegMovetoRel_id,
  318.   eDOMClassInfo_SVGPoint_id,
  319.   eDOMClassInfo_SVGPointList_id,
  320.   eDOMClassInfo_SVGPreserveAspectRatio_id,
  321.   eDOMClassInfo_SVGRect_id,
  322.   eDOMClassInfo_SVGTransform_id,
  323.   eDOMClassInfo_SVGTransformList_id,
  324.   eDOMClassInfo_SVGZoomEvent_id,
  325. #endif // MOZ_SVG
  326.  
  327.   // Canvas
  328.   eDOMClassInfo_HTMLCanvasElement_id,
  329. #ifdef MOZ_ENABLE_CANVAS
  330.   eDOMClassInfo_CanvasRenderingContext2D_id,
  331.   eDOMClassInfo_CanvasGradient_id,
  332.   eDOMClassInfo_CanvasPattern_id,
  333. #endif
  334.   
  335.   // SmartCard Events
  336.   eDOMClassInfo_SmartCardEvent_id,
  337.   
  338.   // PageTransition Events
  339.   eDOMClassInfo_PageTransitionEvent_id,
  340.  
  341.   eDOMClassInfo_Constructor_id,
  342.  
  343.   // Define this near the end so that enabling/disabling foreignobject doesn't
  344.   // break binary compatibility
  345. #if defined(MOZ_SVG) && defined(MOZ_SVG_FOREIGNOBJECT)
  346.   eDOMClassInfo_SVGForeignObjectElement_id,
  347. #endif
  348.  
  349.   // This one better be the last one in this list
  350.   eDOMClassInfoIDCount
  351. };
  352.  
  353. #include "nsIXPCScriptable.h"
  354.  
  355. #define DEFAULT_SCRIPTABLE_FLAGS                                           \
  356.   (nsIXPCScriptable::USE_JSSTUB_FOR_ADDPROPERTY |                          \
  357.    nsIXPCScriptable::USE_JSSTUB_FOR_DELPROPERTY |                          \
  358.    nsIXPCScriptable::USE_JSSTUB_FOR_SETPROPERTY |                          \
  359.    nsIXPCScriptable::ALLOW_PROP_MODS_DURING_RESOLVE |                      \
  360.    nsIXPCScriptable::ALLOW_PROP_MODS_TO_PROTOTYPE |                        \
  361.    nsIXPCScriptable::DONT_ASK_INSTANCE_FOR_SCRIPTABLE |                    \
  362.    nsIXPCScriptable::DONT_REFLECT_INTERFACE_NAMES |                        \
  363.    nsIXPCScriptable::WANT_NEWRESOLVE |                                     \
  364.    nsIXPCScriptable::WANT_CHECKACCESS |                                    \
  365.    nsIXPCScriptable::WANT_PRECREATE |                                      \
  366.    nsIXPCScriptable::WANT_POSTCREATE)
  367.  
  368. #define DOM_DEFAULT_SCRIPTABLE_FLAGS                                       \
  369.   (DEFAULT_SCRIPTABLE_FLAGS |                                              \
  370.    nsIXPCScriptable::DONT_ENUM_QUERY_INTERFACE |                           \
  371.    nsIXPCScriptable::CLASSINFO_INTERFACES_ONLY)
  372.  
  373.  
  374. typedef nsIClassInfo* (*nsDOMClassInfoExternalConstructorFnc)
  375.   (const char* aName);
  376.  
  377.  
  378. /**
  379.  * nsIClassInfo helper macros
  380.  */
  381.  
  382. #define NS_CLASSINFO_MAP_BEGIN(_class)
  383.  
  384. #define NS_CLASSINFO_MAP_BEGIN_EXPORTED(_class)
  385.  
  386. #define NS_CLASSINFO_MAP_ENTRY(_interface)
  387.  
  388. #define NS_CLASSINFO_MAP_ENTRY_FUNCTION(_function)
  389.  
  390. #define NS_CLASSINFO_MAP_END
  391.  
  392.  
  393. #include "nsIServiceManager.h"
  394. #include "nsIDOMScriptObjectFactory.h"
  395. #include "nsDOMCID.h"
  396.  
  397. #define NS_INTERFACE_MAP_ENTRY_DOM_CLASSINFO(_class)                       \
  398.   if (aIID.Equals(NS_GET_IID(nsIClassInfo))) {                             \
  399.     static NS_DEFINE_CID(kDOMSOF_CID, NS_DOM_SCRIPT_OBJECT_FACTORY_CID);   \
  400.                                                                            \
  401.     nsresult rv;                                                           \
  402.     nsCOMPtr<nsIDOMScriptObjectFactory> sof(do_GetService(kDOMSOF_CID,     \
  403.                                                           &rv));           \
  404.     if (NS_FAILED(rv)) {                                                   \
  405.       *aInstancePtr = nsnull;                                              \
  406.       return rv;                                                           \
  407.     }                                                                      \
  408.                                                                            \
  409.     foundInterface =                                                       \
  410.       sof->GetClassInfoInstance(eDOMClassInfo_##_class##_id);              \
  411.   } else
  412.  
  413. // Looks up the nsIClassInfo for a class name registered with the 
  414. // nsScriptNamespaceManager. Remember to release NS_CLASSINFO_NAME(_class)
  415. // (eg. when your module unloads).
  416. #define NS_INTERFACE_MAP_ENTRY_EXTERNAL_DOM_CLASSINFO(_class)              \
  417.   if (aIID.Equals(NS_GET_IID(nsIClassInfo))) {                             \
  418.     extern nsISupports *NS_CLASSINFO_NAME(_class);                         \
  419.     if (NS_CLASSINFO_NAME(_class)) {                                       \
  420.       foundInterface = NS_CLASSINFO_NAME(_class);                          \
  421.     } else {                                                               \
  422.       static NS_DEFINE_CID(kDOMSOF_CID, NS_DOM_SCRIPT_OBJECT_FACTORY_CID); \
  423.                                                                            \
  424.       nsresult rv;                                                         \
  425.       nsCOMPtr<nsIDOMScriptObjectFactory> sof(do_GetService(kDOMSOF_CID,   \
  426.                                                             &rv));         \
  427.       if (NS_FAILED(rv)) {                                                 \
  428.         *aInstancePtr = nsnull;                                            \
  429.         return rv;                                                         \
  430.       }                                                                    \
  431.                                                                            \
  432.       foundInterface =                                                     \
  433.         sof->GetExternalClassInfoInstance(NS_LITERAL_STRING(#_class));     \
  434.                                                                            \
  435.       if (foundInterface) {                                                \
  436.         NS_CLASSINFO_NAME(_class) = foundInterface;                        \
  437.         NS_CLASSINFO_NAME(_class)->AddRef();                               \
  438.       }                                                                    \
  439.     }                                                                      \
  440.   } else
  441.  
  442.  
  443. #define NS_DECL_DOM_CLASSINFO(_class) \
  444.   nsISupports *NS_CLASSINFO_NAME(_class) = nsnull;
  445.  
  446. // {891a7b01-1b61-11d6-a7f2-f690b638899c}
  447. #define NS_IDOMCI_EXTENSION_IID  \
  448. { 0x891a7b01, 0x1b61, 0x11d6, \
  449. { 0xa7, 0xf2, 0xf6, 0x90, 0xb6, 0x38, 0x89, 0x9c } }
  450.  
  451. class nsIDOMScriptObjectFactory;
  452.  
  453. class nsIDOMCIExtension : public nsISupports {
  454. public:  
  455.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDOMCI_EXTENSION_IID)
  456.  
  457.   NS_IMETHOD RegisterDOMCI(const char* aName,
  458.                            nsIDOMScriptObjectFactory* aDOMSOFactory) = 0;
  459. };
  460.  
  461.  
  462. #define NS_DOMCI_EXTENSION_NAME(_module) ns##_module##DOMCIExtension
  463. #define NS_DOMCI_EXTENSION_CONSTRUCTOR(_module) \
  464.   ns##_module##DOMCIExtensionConstructor
  465. #define NS_DOMCI_EXTENSION_CONSTRUCTOR_IMP(_extension) \
  466.   NS_GENERIC_FACTORY_CONSTRUCTOR(_extension)
  467.  
  468. #define NS_DOMCI_EXTENSION(_module)                                       \
  469. class NS_DOMCI_EXTENSION_NAME(_module) : public nsIDOMCIExtension         \
  470. {                                                                         \
  471. public:                                                                   \
  472.   NS_DOMCI_EXTENSION_NAME(_module)();                                     \
  473.   virtual ~NS_DOMCI_EXTENSION_NAME(_module)();                            \
  474.                                                                           \
  475.   NS_DECL_ISUPPORTS                                                       \
  476.                                                                           \
  477.   NS_IMETHOD RegisterDOMCI(const char* aName,                             \
  478.                            nsIDOMScriptObjectFactory* aDOMSOFactory);     \
  479. };                                                                        \
  480.                                                                           \
  481. NS_DOMCI_EXTENSION_CONSTRUCTOR_IMP(NS_DOMCI_EXTENSION_NAME(_module))      \
  482.                                                                           \
  483. NS_DOMCI_EXTENSION_NAME(_module)::NS_DOMCI_EXTENSION_NAME(_module)()      \
  484. {                                                                         \
  485. }                                                                         \
  486.                                                                           \
  487. NS_DOMCI_EXTENSION_NAME(_module)::~NS_DOMCI_EXTENSION_NAME(_module)()     \
  488. {                                                                         \
  489. }                                                                         \
  490.                                                                           \
  491. NS_IMPL_ISUPPORTS1(NS_DOMCI_EXTENSION_NAME(_module), nsIDOMCIExtension)   \
  492.                                                                           \
  493. NS_IMETHODIMP                                                             \
  494. NS_DOMCI_EXTENSION_NAME(_module)::RegisterDOMCI(const char* aName,        \
  495.                                                 nsIDOMScriptObjectFactory* aDOMSOFactory) \
  496. {
  497.  
  498. #define NS_DOMCI_EXTENSION_ENTRY_BEGIN(_class)                            \
  499.   if (nsCRT::strcmp(aName, #_class) == 0) {                               \
  500.     static const nsIID* interfaces[] = {
  501.  
  502. #define NS_DOMCI_EXTENSION_ENTRY_INTERFACE(_interface)                    \
  503.       &NS_GET_IID(_interface),
  504.  
  505. // Don't forget to register the primary interface (_proto) in the 
  506. // JAVASCRIPT_DOM_INTERFACE category, or prototypes for this class
  507. // won't work (except if the interface name starts with nsIDOM).
  508. #define NS_DOMCI_EXTENSION_ENTRY_END_HELPER(_class, _proto, _hasclassif,  \
  509.                                             _constructorcid)              \
  510.       nsnull                                                              \
  511.     };                                                                    \
  512.     aDOMSOFactory->RegisterDOMClassInfo(#_class, nsnull, _proto,          \
  513.                                         interfaces,                       \
  514.                                         DOM_DEFAULT_SCRIPTABLE_FLAGS,     \
  515.                                         _hasclassif, _constructorcid);    \
  516.     return NS_OK;                                                         \
  517.   }
  518.  
  519. #define NS_DOMCI_EXTENSION_ENTRY_END(_class, _proto, _hasclassif,         \
  520.                                      _constructorcid)                     \
  521.   NS_DOMCI_EXTENSION_ENTRY_END_HELPER(_class, &NS_GET_IID(_proto),        \
  522.                                       _hasclassif, _constructorcid)
  523.  
  524. #define NS_DOMCI_EXTENSION_ENTRY_END_NO_PRIMARY_IF(_class, _hasclassif,   \
  525.                                                    _constructorcid)       \
  526.   NS_DOMCI_EXTENSION_ENTRY_END_HELPER(_class, nsnull, _hasclassif,        \
  527.                                       _constructorcid)
  528.  
  529. #define NS_DOMCI_EXTENSION_END                                            \
  530.   return NS_ERROR_FAILURE;                                                \
  531. }
  532.  
  533.  
  534. #endif /* nsIDOMClassInfo_h___ */
  535.